<template>
  <div>
    <InfoTable ref="InfoTable" location="defects" :filterFields="filterFields" :fixed="false">
      <template slot="table-operation" slot-scope="row">
        <b-btn variant="outline-primary" style="margin-right:8px;padding:6px;font-size:0.7rem">查看问题</b-btn>
        <b-btn variant="outline-primary" style="margin-right:8px;padding:6px;font-size:0.7rem" @click="info(row)">详细信息</b-btn>
        <b-btn variant="outline-primary" style="margin-right:8px;padding:6px;font-size:0.7rem" @click="remove(row)">删除</b-btn>
      </template>
      <template slot="table-status" slot-scope="row">
        {{row.data.item.status | status}}
      </template>
      <template slot="table-type" slot-scope="row">
        {{row.data.item.type | type}}
      </template>
    </InfoTable>
  </div>
</template>

<script>
import InfoModal from "components/InfoModal";
import InfoTable from "components/InfoTable";
export default {
  name: "Manager",
  components: {
    InfoTable,
    InfoModal
  },
  data() {
    return {
      filterFields: ["status", "type"]
    };
  },
  filters: {
    status: function(value) {
      switch (value) {
        case 1:
          return "问题已经提交";
          break;
        case 2:
          return "问题正在解决";
          break;
        case 3:
          return "问题还在分析";
          break;
        case 4:
          return "问题解决成功";
          break;
        case 5:
          return "问题解决失败";
          break;
      }
    },
    type: function(value) {
      switch (value) {
        case 1:
          return "需求问题";
          break;
        case 2:
          return "界面问题";
          break;
        case 3:
          return "核心问题";
          break;
        case 4:
          return "问题解决成功";
          break;
        case 5:
          return "其他问题";
          break;
      }
    }
  },
  methods: {
    info(row) {
      console.log(row);
      this.$refs.InfoTable.info(row.data);
    },
    remove(row) {
      this.$refs.InfoTable.remove(row.data);
    }
  }
};
</script>
<style lang="scss">
</style>
